package com.zggk.iroad.diease.dieasedb;

import android.app.Activity;
import android.content.Context;

import com.alibaba.fastjson.JSON;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.zggk.iroad.api.Urls;
import com.zggk.iroad.callback.StringDialogCallback;
import com.zggk.iroad.log.LogSuccessBean;
import com.zggk.iroad.mvp.BasePresenterImpl;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class DieaseDbPresenter extends BasePresenterImpl<DieaseDbContract.View> implements DieaseDbContract.Presenter{
    @Override
    public void addLog(String json, Activity activity) {
        OkGo.<String>post(Urls.YNIP + "MobileUpdatebh")
                .params("json",json)
                .execute(new StringDialogCallback(activity) {
                    @Override
                    public void onSuccess(Response<String> response) {
                        if (mView == null)
                            return;
                        LogSuccessBean logSuccessBean =  JSON.parseObject(response.body(),LogSuccessBean.class);
                        mView.addLogs(logSuccessBean.getState());
                    }
                });
    }
}
